package com.tutorial.annotation;

import com.tutorial.annotation.config.SpringConfig;
import com.tutorial.annotation.service.Target;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 注解方式实现aop
 * className: ApplicationContextConfig
 * author: GXW
 * date: 2025/7/30 09:56:59
 * description: TODO 注解方式实现aop
 */
public class ApplicationContextConfig {
	public static void main(String[] args) {
		ApplicationContext context = new ClassPathXmlApplicationContext("ApplicationContext-annotation.xml");
		Target bean = context.getBean(Target.class);
		bean.show();
		// 注解方式
		ApplicationContext applicationContext = new AnnotationConfigApplicationContext(SpringConfig.class);
		Target target = applicationContext.getBean(Target.class);
		target.show();
	}
}
